namespace Templates
{
	public class Inheritance : IParse
	{
		public string Name { get; set; }
		public string Namespace { get; set; }

		#region Implementation of IParse

		public string ParseToString()
		{
			return string.Format("{0}.{1}", Namespace, Name);
		}

		public object ParseToObject(string type, string value)
		{
			if (type != "Templates.Inheritance" || string.IsNullOrWhiteSpace(value))
				throw new System.NotImplementedException();
			var ar = value.Split('.');

			var ns = string.Empty;

			for (int i = 0; i < ar.Length - 1; i++)
			{
				ns = string.Format("{0}.{1}", ns, ar[i]);
			}


			return new Inheritance()
			       	{
			       		Namespace = ns.TrimStart('.'),
			       		Name = ar[ar.Length - 1],
			       	};
		}

		#endregion
	}

	public interface IParse
	{
		string ParseToString();
		object ParseToObject(string type, string value);
	}
}